<?php $this->load->view('tourism/layout/header') ?>
<header class="am-search details">
    <ul class="am-cf">
        <li class="r-black">
            <a href="javascript:history.go(-1);">
                <i class="iconfont icon-zuojiantou"></i>
            </a>
        </li>
        <li class="header-input">
            <p>余额支付</p>
        </li>
        <li class="header-home">
           <?php $this->load->view('tourism/layout/nav'); ?>
        </li>
    </ul>
</header>
<div class="circuittest-first">
    <div class="hint-pay">
        <i class="iconfont">&#xe629;</i>
        <span>您正在安全支付环境中，请放心付款</span>
    </div>
    <div class="pay-money">
        <p>付款金额</p>
        <p class="money">￥<span><?php echo $orderInfo->order_amount; ?></span></p>
    </div>
    <div class="payment-code">
        <form id="form-balance-pay" action="<?php echo site_url('tourism/payment/balancePayForm')?>"  method="POST">
            <input name="order_sn" value="<?php echo $orderInfo->order_sn; ?>" type="hidden" >
            <div class="am-form-group">
                <div class="group-box">
                     <label>请输入支付密码</label>
                     <a href="<?php echo site_url('home/safetycenter/selectPaymentStrategy') ;?>">忘记支付密码</a>
                </div>
                <input type="password" name="password" class="am-form-field" placeholder="请输入支付密码"/>
            </div>
            <div class="mode-sure">
                <button type="submit" class="am-btn am-btn-default">确认支付</button>
            </div>
        </form>
    </div>
</div>
<?php $this->load->view('tourism/layout/footer') ?>
<script type="text/javascript">
    jQuery(document).ready(function() {
        $('#form-balance-pay').submit(function () {
            return false;
        }).validate({
            submitHandler: function (f) {
                $.ajax({
                    type: 'post',
                    async: true,
                    dataType: 'json',
                    beforeSend:function(){
                        $('button[type="submit"]').text('正在支付').prop('disabled', true);
                    },
                    url: hostUrl() + '/payment/balancePayForm',
                    data: $('#form-balance-pay').serialize(),
                    success: function (data) {
                        if (data.status) {
                            window.location.href = data.msg;
                        } else {
                            alertMessage(data.msg);
                            $('button[type="submit"]').text('确认支付').prop('disabled', false);
                        }
                    }
                });
            }
        });
    });
</script>